﻿using System;
using System.Collections.Generic;

namespace MultiVolumeControl.Core
{
	public struct SystemTime
	{
		public ushort wYear;
		public ushort wMonth;
		public ushort wDayOfWeek;
		public ushort wDay;
		public ushort wHour;
		public ushort wMinute;
		public ushort wSecond;
		public ushort wMilliseconds;
		
		public DateTime AsDateTime {
			get {
				return new DateTime(wYear,wMonth,wDay,wHour,wMinute,wSecond,wMilliseconds,DateTimeKind.Utc);
			}
		}
		
		public byte[] AsBytes {
			get {
				List<byte> bytes=new List<byte>();
				bytes.AddRange(BitConverter.GetBytes(wYear));
				bytes.AddRange(BitConverter.GetBytes(wMonth));
				bytes.AddRange(BitConverter.GetBytes(wDayOfWeek));
				bytes.AddRange(BitConverter.GetBytes(wDay));
				bytes.AddRange(BitConverter.GetBytes(wHour));
				bytes.AddRange(BitConverter.GetBytes(wMinute));
				bytes.AddRange(BitConverter.GetBytes(wSecond));
				bytes.AddRange(BitConverter.GetBytes(wMilliseconds));
				return bytes.ToArray();
			}
		}
	}
}